import Vue from 'vue';
import VueRouter from 'vue-router';
import HomeView from '@/views/home/index.vue';

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
  },
  {
    path: '/login',
    name: 'login',
    component: () => import(/* webpackChunkName: "home" */ '../views/user/login.vue'),
  },
  {
    path: '/CourseView',
    name: 'CourseView',
    component: () => import(/* webpackChunkName: "home" */ '../views/home/courseview.vue'),
  },
  {
    path: '/CourseDetail/:courseId',
    name: 'CourseDetail',
    component: () => import(/* webpackChunkName: "home" */ '../views/home/coursedetail.vue'),
    props: true,
  },
  {
    path: '/Lesson/:lessonId',
    name: 'Lesson',
    component: () => import(/* webpackChunkName: "home" */ '../views/home/components/lessonvideo.vue'),
    props: true,
  },
  {
    path: '/LearnView',
    name: 'LearnView',
    component: () => import(/* webpackChunkName: "home" */ '../views/learn/index.vue'),
  },
  {
    path: '/User',
    name: 'User',
    component: () => import(/* webpackChunkName: "home" */ '../views/user/index.vue'),
    meta: { requiresAuth: true },
  },
];

const router = new VueRouter({
  routes,
});

export default router;
